﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace MMS.UI.Areas.Admin.ViewModels
{
    public class GoodsInfoModel
    {
        /// <summary>
        /// 商品编号
        /// </summary>
        public int GId { get; set; }

        [DisplayName("商品名称"), Required(ErrorMessage = "商品名称不能为空")]
        /// <summary>
        /// 商品名称
        /// </summary>
        public string GName { get; set; }

        [DisplayName("商品类别名称"), Required(ErrorMessage = "商品类别名称不能为空")]
        /// <summary>
        /// 商品类别名称
        /// </summary>
        public int? GCId { get; set; }

        [DisplayName("商品成本"), Required(ErrorMessage = "商品成本不能为空")]
        /// <summary>
        /// 商品成本
        /// </summary>
        public decimal? GCostPrice { get; set; }

        [DisplayName("商品售价"), Required(ErrorMessage = "商品售价不能为空")]
        /// <summary>
        /// 商品售价
        /// </summary>
        public decimal? GSellPrice { get; set; }

        [DisplayName("商品库存"), Required(ErrorMessage = "商品库存不能为空")]
        /// <summary>
        /// 商品库存
        /// </summary>
        public int? GInventory { get; set; }
        [DisplayName("商品库存下限"), Required(ErrorMessage = "商品库存下限不能为空")]
        /// <summary>
        /// 商品库存下限
        /// </summary>
        public int? GInmin { get; set; }
        [DisplayName("商品库存上限"), Required(ErrorMessage = "商品库存上限不能为空")]
        /// <summary>
        /// 商品库存上限
        /// </summary>
        public int? GInmax { get; set; }

        [DisplayName("积分比率"), Required(ErrorMessage = "积分比率不能为空")]
        /// <summary>
        /// 积分比率
        /// </summary>
        public double? GIntegralRatio { get; set; }
      
         [DisplayName("备注说明")]
        /// <summary>
        /// 备注说明
        /// </summary>
        public string GRemark { get; set; }

        public MMS.Model.GoodsInfo ToModel()
        {
            return new MMS.Model.GoodsInfo()
            {
                GId = this.GId,
                GCId = this.GCId,
                GCostPrice = this.GCostPrice,
                GSellPrice = this.GSellPrice,
                GInmin = this.GInmin,
                GInmax = this.GInmax,
                GIntegralRatio = this.GIntegralRatio,
                GRemark = this.GRemark,
            
                GInventory = this.GInventory,
                GName = this.GName
            };
        }
    }
}